package  
{
	import flash.display.*;
	import flash.events.*;
	import iks.utils.geom.*;
	import vehicle.*;
	
	public final class AvoidTest extends Sprite 
	{
		
		public function AvoidTest() 
		{
			m_avoidVehicle = new SteeredVehicle();
			m_avoidVehicle.edgeBehavior = Vehicle.WRAP;
			m_avoidVehicle.x = this.stage.stageWidth / 2;
			m_avoidVehicle.y = this.stage.stageHeight / 2;
			this.addChild(m_avoidVehicle);
			
			m_circles = new Vector.<KCircle>(1, true);
			for (var i : int = 0; i < m_circles.length; ++i)
			{
				//var radius : Number = Math.random() * 100 + 100;
				//var circle : KCircle = new KCircle(Math.random() * this.stage.stageWidth, Math.random() * this.stage.stageHeight, radius);
				var radius : Number = 200;
				var circle : KCircle = new KCircle(this.stage.stageWidth / 2, this.stage.stageHeight / 2, radius);
				circle.draw(this.graphics, 1, 0, true, Math.random() * 0xFFFFFF);
				m_circles[i] = circle;
			}
			
			this.addEventListener(Event.ENTER_FRAME, onEnterFrameHandler);
		}
		
		private function onEnterFrameHandler(evt : Event) : void
		{
			m_avoidVehicle.wander();
			m_avoidVehicle.avoid(m_circles);
			m_avoidVehicle.update();
		}
		
		private var m_avoidVehicle : SteeredVehicle = null;
		private var m_circles : Vector.<KCircle> = null;
	}

}

































///////////////////////////////////////////////////////////////////////////////////////////////////
// end file